﻿using System;
using System.Collections.Generic;

namespace NodeJS
{
    using http;

    public abstract class Http
    {
        private Http() { }

        /// <summary>
        /// A collection of all the standard HTTP response status codes, and the short description of each. For example, http.STATUS_CODES[404] === 'Not Found'.
        /// </summary>
        public static Dictionary<int, string> STATUS_CODES = new Dictionary<int, string>() { };

        /// <summary>
        /// Returns a new web server object.
        /// </summary>
        /// <param name="requestListener">The requestListener is a function which is automatically added to the 'request' event.</param>
        /// <returns></returns>
        public Server CreateServer(Action<IncomingMessage, ServerResponse> requestListener)
        {
            return null;
        }

        /// <summary>
        /// Node maintains several connections per server to make HTTP requests. This function allows one to transparently issue requests.
        /// </summary>
        /// <param name="options">options can be an object or a string. If options is a string, it is automatically parsed with url.parse().
        /// <para>host: A domain name or IP address of the server to issue the request to. Defaults to 'localhost'.</para>
        /// <para>hostname: To support url.parse() hostname is preferred over host</para>
        /// <para>port: Port of remote server. Defaults to 80.</para>
        /// <para>localAddress: Local interface to bind for network connections.</para>
        /// <para>socketPath: Unix Domain Socket (use one of host:port or socketPath)</para>
        /// <para>method: A string specifying the HTTP request method. Defaults to 'GET'.</para>
        /// <para>path: Request path. Defaults to '/'. Should include query string if any. E.G. '/index.html?page=12'</para>
        /// <para>headers: An object containing request headers.</para>
        /// <para>auth: Basic authentication i.e. 'user:password' to compute an Authorization header.</para>
        /// <para>agent: Controls Agent behavior. When an Agent is used request will default to Connection: keep-alive. Possible values:
        /// <para>- undefined (default): use global Agent for this host and port.</para>
        /// <para>- Agent object: explicitly use the passed in Agent.</para>
        /// <para>- false: opts out of connection pooling with an Agent, defaults request to Connection: close.</para>        
        /// </para>
        /// </param>
        /// <param name="callback"></param>
        /// <returns>An instance of the http.ClientRequest class. The ClientRequest instance is a writable stream. If one needs to upload a file with a POST request, then write to the ClientRequest object.</returns>
        public ClientRequest Request(object options, Action<ServerResponse> callback)
        {
            return null;
        }

        /// <summary>
        /// Since most requests are GET requests without bodies, Node provides this convenience method.
        /// The only difference between this method and http.request() is that it sets the method to GET and calls req.end() automatically.
        /// </summary>
        /// <param name="options">options can be an object or a string. If options is a string, it is automatically parsed with url.parse().
        /// <para>host: A domain name or IP address of the server to issue the request to. Defaults to 'localhost'.</para>
        /// <para>hostname: To support url.parse() hostname is preferred over host</para>
        /// <para>port: Port of remote server. Defaults to 80.</para>
        /// <para>localAddress: Local interface to bind for network connections.</para>
        /// <para>socketPath: Unix Domain Socket (use one of host:port or socketPath)</para>
        /// <para>path: Request path. Defaults to '/'. Should include query string if any. E.G. '/index.html?page=12'</para>
        /// <para>headers: An object containing request headers.</para>
        /// <para>auth: Basic authentication i.e. 'user:password' to compute an Authorization header.</para>
        /// <para>agent: Controls Agent behavior. When an Agent is used request will default to Connection: keep-alive. Possible values:
        /// <para>- undefined (default): use global Agent for this host and port.</para>
        /// <para>- Agent object: explicitly use the passed in Agent.</para>
        /// <para>- false: opts out of connection pooling with an Agent, defaults request to Connection: close.</para>        
        /// </para>
        /// </param>
        /// <param name="callback"></param>
        /// <returns></returns>
        public ClientRequest Get(object options, Action<ServerResponse> callback)
        {
            return null;
        }
    }
}
